package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UserAnswersMapper;
import com.ruoyi.system.domain.UserAnswers;
import com.ruoyi.system.service.IUserAnswersService;

/**
 * 答题记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-09
 */
@Service
public class UserAnswersServiceImpl implements IUserAnswersService 
{
    @Autowired
    private UserAnswersMapper userAnswersMapper;

    /**
     * 查询答题记录
     * 
     * @param recordId 答题记录主键
     * @return 答题记录
     */
    @Override
    public UserAnswers selectUserAnswersByRecordId(Long recordId)
    {
        return userAnswersMapper.selectUserAnswersByRecordId(recordId);
    }

    /**
     * 查询答题记录列表
     * 
     * @param userAnswers 答题记录
     * @return 答题记录
     */
    @Override
    public List<UserAnswers> selectUserAnswersList(UserAnswers userAnswers)
    {
        return userAnswersMapper.selectUserAnswersList(userAnswers);
    }

    /**
     * 新增答题记录
     * 
     * @param userAnswers 答题记录
     * @return 结果
     */
    @Override
    public int insertUserAnswers(UserAnswers userAnswers)
    {
        userAnswers.setCreateTime(DateUtils.getNowDate());
        return userAnswersMapper.insertUserAnswers(userAnswers);
    }

    /**
     * 修改答题记录
     * 
     * @param userAnswers 答题记录
     * @return 结果
     */
    @Override
    public int updateUserAnswers(UserAnswers userAnswers)
    {
        userAnswers.setUpdateTime(DateUtils.getNowDate());
        return userAnswersMapper.updateUserAnswers(userAnswers);
    }

    /**
     * 批量删除答题记录
     * 
     * @param recordIds 需要删除的答题记录主键
     * @return 结果
     */
    @Override
    public int deleteUserAnswersByRecordIds(Long[] recordIds)
    {
        return userAnswersMapper.deleteUserAnswersByRecordIds(recordIds);
    }

    /**
     * 删除答题记录信息
     * 
     * @param recordId 答题记录主键
     * @return 结果
     */
    @Override
    public int deleteUserAnswersByRecordId(Long recordId)
    {
        return userAnswersMapper.deleteUserAnswersByRecordId(recordId);
    }
}
